import admin_service from "@/api/admin_service";
import service from "@/service";

//添加管理员
export function addAdmin(adminList){
    return admin_service({
        method: 'post',
        url: '/addAdmin',
        data:adminList
    })
}

// 删除管理员
export function deleteAdmin(username){
    return admin_service({
        method:'get',
        url: '/deleteAdmin/'+username,
    })
}

// 修改管理员信息
export function updateAdmin(admin){
    return admin_service({
        method:'post',
        url: '/updateByName/',
        data: admin
    })

}

// 登录请求
export function login(data){
    return admin_service({
        method: 'post',
        url: '/adminLogin',
        data
    })
}

// 获取单个管理员信息
export function admin(id){
    return admin_service({
        method: 'get',
        url: '/showImage/'+id,
    })
}

//获取所有管理员
export function showAdmin(){
    return admin_service({
        method:'get',
        url:'/selectAdmin',
    })
}

//获得管理员信息
export function adminDetail(name){
    return admin_service({
        method:'get',
        url:'/selectByName/'+name
    })
}


export function getName(){
    return admin_service({
        method:'get',
        url:'/'
    })
}



// 根据博客id获取审核通过博客
export function getBlog(blogId){
    return service({
        method:'get',
        url:'/user/get-blog/'+blogId
    })
}

//根据词条获取博客id
export function getBlogId(param){
    return service({
        method:'get',
        url:'/user/hot/some-type/'+param
    })

}

//根据用户id获取用户
export function getUserById(userId){
    return service({
        method:'get',
        url:'/user/get-user/'+userId
    })
}

// 获得未审核博客id列表
export function getCheckBlogId(){
    return service({
        method:'get',
        url:'/manage-blog/unverify-blog-ids'
    })
}

//更改博客为审核通过
export function updateCheckBlog(blogId){
    return service({
        method:'get',
        url:'/manage-blog/verify-blog/'+blogId
    })
}


